<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>日期框之验证 - jQuery EasyUI 演示</title>
	<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
	<link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css">
	<link rel="stylesheet" type="text/css" href="../../themes/icon.css">
	<link rel="stylesheet" type="text/css" href="../demo.css">
	<script type="text/javascript" src="../../jquery.min.js"></script>
	<script type="text/javascript" src="../../jquery.easyui.min.js"></script>
	<script type="text/javascript" src="../../locale/easyui-lang-zh_CN.js"></script>
</head>
<body>
	<h2 title="Validate DateBox">日期框之验证</h2>
	<p title="When the selected date is greater than specified date. The field validator will raise an error.">　　未选日期时报错；当【截止日期】的选定值大于特定值（2018年1月16日）时，验证器会抛出一个错误。</p>
	<div class="easyui-panel" style="width:100%;max-width:280px;padding:10px 20px;">
		<div style="margin-bottom:10px">
			<input class="easyui-datebox" label="要求日期：" labelPosition="left" labelWidth="80" labelAlign="right" required style="width:100%;">
		</div>
		<div style="margin-bottom:0px">
			<input class="easyui-datebox" label="截止日期：" labelPosition="left" labelWidth="80" labelAlign="right" required data-options="validType:'md[\'2018-01-16\']'" style="width:100%;">
		</div>
	</div>
	<script>
		$.extend($.fn.validatebox.defaults.rules, {
			md: {
				validator: function(value, param){
					var d1 = $.fn.datebox.defaults.parser(param[0]);
					var d2 = $.fn.datebox.defaults.parser(value);
					return d2<=d1;
				},
				message: '日期必须小于等于上限值（{0}）。'
			}
		})
	</script>
</body>
</html>